package me.panpf.sketch.sample.bean;

import com.google.gson.annotations.SerializedName;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class UnsplashImage {
    @SerializedName("id")
    @Nullable
    private String id;
    @SerializedName("created_at")
    @Nullable
    private String createdAt;
    @SerializedName("updated_at")
    @Nullable
    private String updatedAt;
    @SerializedName("width")
    private int width;
    @SerializedName("height")
    private int height;
    @SerializedName("color")
    @Nullable
    private String color;

    @SerializedName("user")
    private User user;

    @SerializedName("urls")
    private Urls urls;

    @SerializedName("likes")
    private int likes;

    @SerializedName("liked_by_user")
    private boolean likedByUser;

    //    @Transient
    private String formattedUpdateDate;

    public String getId() {
        return id;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public String getUpdatedAt() {
        return updatedAt;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public String getColor() {
        return color;
    }

    public User getUser() {
        return user;
    }

    public Urls getUrls() {
        return urls;
    }

    public int getLikes() {
        return likes;
    }

    public boolean isLikedByUser() {
        return likedByUser;
    }

    public String getFormattedUpdateDate() {
        if (formattedUpdateDate == null && (updatedAt != null && updatedAt.length() != 0) && (updatedAt.length() >= 10)) {
            formattedUpdateDate = updatedAt.substring(0, 10).replace("-", ".");
        }
        return formattedUpdateDate;
    }

    public static final class User {
        @SerializedName("id")
        private String id;

        @SerializedName("updatedAt")
        private String updated_at;

        @SerializedName("username")
        private String username ;

        @SerializedName("name")
        private String name ;

        @SerializedName("first_name")
        private String firstName ;

        @SerializedName("last_name")
        private String lastName ;

        @SerializedName("portfolio_url")
        private String portfolioUrl ;

        @SerializedName("bio")
        private String bio ;

        @SerializedName("location")
        private String location ;

        @SerializedName("total_likes")
        private int totalLikes;

        @SerializedName("total_photos")
        private int totalPhotos ;

        @SerializedName("total_collections")
        private int totalCollections ;

        @SerializedName("profile_image")
        private ProfileImage profileImage;

        @SerializedName("links")
        private Links links;

        public String getId() {
            return id;
        }

        public String getUpdated_at() {
            return updated_at;
        }

        public String getUsername() {
            return username;
        }

        public String getName() {
            return name;
        }

        public String getFirstName() {
            return firstName;
        }

        public String getLastName() {
            return lastName;
        }

        public String getPortfolioUrl() {
            return portfolioUrl;
        }

        public String getBio() {
            return bio;
        }

        public String getLocation() {
            return location;
        }

        public int getTotalLikes() {
            return totalLikes;
        }

        public int getTotalPhotos() {
            return totalPhotos;
        }

        public int getTotalCollections() {
            return totalCollections;
        }

        public ProfileImage getProfileImage() {
            return profileImage;
        }

        public Links getLinks() {
            return links;
        }

        public static final class ProfileImage {
            @SerializedName("small")
            private String small ;

            @SerializedName("medium")
            private String medium ;

            @SerializedName("large")
            private String large ;

            public String getSmall() {
                return small;
            }

            public String getMedium() {
                return medium;
            }

            public String getLarge() {
                return large;
            }
        }

        public static final class Links {
            @SerializedName("self")
            private String self ;

            @SerializedName("html")
            private String html ;

            @SerializedName("photos")
            private String photos ;

            @SerializedName("likes")
            private String likes ;

            @SerializedName("portfolio")
            private String portfolio ;

            @SerializedName("following")
            private String following ;

            @SerializedName("followers")
            private String followers ;

            public String getSelf() {
                return self;
            }

            public String getHtml() {
                return html;
            }

            public String getPhotos() {
                return photos;
            }

            public String getLikes() {
                return likes;
            }

            public String getPortfolio() {
                return portfolio;
            }

            public String getFollowing() {
                return following;
            }

            public String getFollowers() {
                return followers;
            }
        }
    }

    public static final class Urls {
        @SerializedName("raw")
        private String raw ;

        @SerializedName("full")
        private String full;

        @SerializedName("regular")
        private String regular ;

        @SerializedName("small")
        private String small ;

        @SerializedName("thumb")
        private String thumb ;

        public String getRaw() {
            return raw;
        }

        public String getFull() {
            return full;
        }

        public String getRegular() {
            return regular;
        }

        public String getSmall() {
            return small;
        }

        public String getThumb() {
            return thumb;
        }
    }


}
